/*******************************************************************************
 * Copyright (c) 2008-2010 Cedric Vidal
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Cedric Vidal - original idea, initial contribution and API
 *******************************************************************************/

/**
 * 
 */
package org.trans4j.spring.tests.mappers.xml;

import org.trans4j.spring.tests.model.LeftChild;
import org.trans4j.spring.tests.model.RightChild;

public class ChildMapper {

	private ParentMapper parentMapper;

	public ParentMapper getParentMapper() {
		return parentMapper;
	}

	public void setParentMapper(ParentMapper parentMapper) {
		this.parentMapper = parentMapper;
	}

	public RightChild child(LeftChild b) {
		RightChild a = new RightChild();
		a.setRightName(b.getLeftName().replace("left", "right"));
		a.setRightParent(parentMapper.parent(b.getLeftParent()));
		return a;
	}

}
